summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorPeter Bell <peterbell10@live.co.uk>2020-05-09 17:51:54 +0200
committerpeterbell10 <peterbell10@live.co.uk>2020-05-09 21:37:16 +0200
commit1123c95cf2efdcb23ff557b956d58538ca24aefe (patch)
treee8f39c2519ad06afc4f52d8fbc1d8fb334aeea42 /Tools
parentUpdate submodules (#4727) (diff)
downloadcuberite-1123c95cf2efdcb23ff557b956d58538ca24aefe.tar
cuberite-1123c95cf2efdcb23ff557b956d58538ca24aefe.tar.gz
cuberite-1123c95cf2efdcb23ff557b956d58538ca24aefe.tar.bz2
cuberite-1123c95cf2efdcb23ff557b956d58538ca24aefe.tar.lz
cuberite-1123c95cf2efdcb23ff557b956d58538ca24aefe.tar.xz
cuberite-1123c95cf2efdcb23ff557b956d58538ca24aefe.tar.zst
cuberite-1123c95cf2efdcb23ff557b956d58538ca24aefe.zip
Diffstat (limited to 'Tools')
-rw-r--r--Tools/GrownBiomeGenVisualiser/Globals.h7
-rw-r--r--Tools/NoiseSpeedTest/Globals.h7
2 files changed, 14 insertions, 0 deletions
diff --git a/Tools/GrownBiomeGenVisualiser/Globals.h b/Tools/GrownBiomeGenVisualiser/Globals.h
index 33c983bf3..f062b4ccf 100644
--- a/Tools/GrownBiomeGenVisualiser/Globals.h
+++ b/Tools/GrownBiomeGenVisualiser/Globals.h
@@ -234,6 +234,13 @@ T Clamp(T a_Value, T a_Min, T a_Max)
return (a_Value < a_Min) ? a_Min : ((a_Value > a_Max) ? a_Max : a_Value);
}
+template <typename T>
+auto ToUnsigned(T a_Val)
+{
+ ASSERT(a_Val >= 0);
+ return static_cast<std::make_unsigned_t<T>>(a_Val);
+}
+
diff --git a/Tools/NoiseSpeedTest/Globals.h b/Tools/NoiseSpeedTest/Globals.h
index 22f39575e..f0400f853 100644
--- a/Tools/NoiseSpeedTest/Globals.h
+++ b/Tools/NoiseSpeedTest/Globals.h
@@ -230,3 +230,10 @@ T Clamp(T a_Value, T a_Min, T a_Max)
{
return (a_Value < a_Min) ? a_Min : ((a_Value > a_Max) ? a_Max : a_Value);
}
+
+template <typename T>
+auto ToUnsigned(T a_Val)
+{
+ ASSERT(a_Val >= 0);
+ return static_cast<std::make_unsigned_t<T>>(a_Val);
+}